/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package dbo;

import java.util.Arrays;
import java.util.List;
import java.util.Vector;

/**
 *
 * @author bi
 */
public class Weapon {
    private String name;
    private int damage;
    private int penetration;
    private float accuracy;
    private int round;
    private int spread;
    private Vector<String> skill;

    public Weapon(String name, int damage, int penetration, float accuracy, int round, int spread, String skill) {
        this.name = name;
        this.damage = damage;
        this.penetration = penetration;
        this.accuracy = accuracy;
        this.round = round;
        this.spread = spread;

        this.skill = new Vector<String>();
        String[] skillList = skill.split(",");
        this.skill.addAll(Arrays.asList(skillList));
    }

    public Weapon(String name) {
        this.name = name;
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @return the damage
     */
    public int getDamage() {
        return damage;
    }

    /**
     * @return the penetration
     */
    public int getPenetration() {
        return penetration;
    }

    /**
     * @return the accuracy
     */
    public float getAccuracy() {
        return accuracy;
    }

    /**
     * @return the round
     */
    public int getRound() {
        return round;
    }

    /**
     * @return the spread
     */
    public int getSpread() {
        return spread;
    }

    /**
     * @return the skill
     */
    public boolean hasSkill(String skillName) {
        return skill.contains(skillName);
    }

    public Vector<String> getSkill() {
        return skill;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj.getClass().equals(this.getClass())) {
            if (this.hashCode() == obj.hashCode()) {
                return true;
            }
        }
        return false;
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 83 * hash + (this.name != null ? this.name.hashCode() : 0);
        return hash;
    }


}
